﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OpenExpressApp
{
    public interface IUnity
    {
        /// <summary>
        /// 没找到，则返回null
        /// </summary>
        /// <typeparam name="TAbstract"></typeparam>
        /// <returns></returns>
        TAbstract Resolve<TAbstract>() where TAbstract : class;
        /// <summary>
        /// 没找到，则返回null
        /// </summary>
        /// <param name="abstractType"></param>
        /// <returns></returns>
        object Resolve(Type abstractType);

        void RegisterType(Type astractType, Type concreteType);
        void RegisterType<TAbstract, TConcreate>()
            where TAbstract : class
            where TConcreate : class;
        void RegisterInstance<TAbstract>(object singleton) where TAbstract : class;
        void RegisterInstance(Type astractType, object singleton);
    }
}
